<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

	<head id="Head1">
		<title>
			登入高水蔬菜批发市场ERP系统
		</title>
		<meta charset="UTF-8">
		<link rel="Stylesheet" href="../../../CSS/login/Login-new.css" />
		<link type="text/css" rel="stylesheet" href="../../../CSS/login/common.css" />
		<link rel="stylesheet" type="text/css" href="../../../Themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../../../Themes/icon.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/demo.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/common.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/login.css" />
	</head>

	<body class="loginbody">
		<form name="form1" method="post" id="form1">
			<div id="pageContainer" class="LoginContentBG">
				<div id="content" class="loginContent">
					<!-- head -->
					<div class="headerBackground">
						<div id="header">
							<!--<span id="login_logo" class="header_left" style="background:url(Portal/Style/Ufida/Image/login-new/TPLUSSTDLogo.png) no-repeat;"></span><span id="packagetype" style="margin: 33px auto auto -35px; float: left; font-size: 16px; color:Red; font-weight:bold;"></span>-->
							<span class="header_left" style="font-weight:700;font-size: 21px;font-family: '微软雅黑';"><img src="../../../images/login/login_logo.png" width="240px" height="55px"/></span>
						</div>
						<div id="guide">
							<div id="guide_SetBrowser"><span id="Span2" style="font-size:14px;"><br />初次使用,请点击浏览器设置</span><br /><span id="Span3" style="cursor:hand; text-decoration:underline; color:#188bea; font-size:14px;" onclick="javascript:document.getElementById('guide_SetBrowser').style.visibility = 'hidden';">关闭</span></div>
						</div>

					</div>
					<!-- center -->
					<div id="Centerlogin" class="CenterBackground">
						<div id="login_controls_layout" class="login_controls_layout">
							<div class="CenterLeft" id="idTransformView2">
								<img src="../../../images/login/web1.png">
							</div>
							<div id="CenterRight" class="CenterRight">
								<div class="login_controls" style="padding-left: 2%;padding-top: 50px;">
									<table cellspacing="5" cellpadding="11" id="login">
										<tr>
											<th align="center" valign="center"><img src="../../../images/login/username.png" alt="" /></th>
											<td>
												<input type="text" id="txtUserName" placeholder="请输入你的用户名" maxlength="18" />
											</td>
										</tr>
										<tr>
											<th align="center" valign="center"><img src="../../../images/login/password.png" alt="" /></th>
											<td>
												<input type="password" id="txtPassword" placeholder="请输入密码" maxlength="16" />
											</td>
										</tr>
										<tr>
											<th><img src="../../../images/login/code.png" alt="" /></th>
											<td class="flip"> <input type="identify" id="identifying_code" placeholder="点击输入验证码" maxlength="5" /></td>
										</tr>
									</table>
									<div class="panel1" style="width: 290px;">
										<div class="code" id="checkCode" onclick="createCode()"></div>
									</div>
									<div id="btn_group">
										<input type="button" id="btnLogin" value="登录" class="usergo" onclick="login();" />
										<input type="button" id="btn2" value="重置" onclick="formReset();" />
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="InfoFooterBackground">
						<div id="chanjetServerTitle" class="chanjetServerTel" style="font-weight: 300;letter-spacing: 3px;">版权所有:绵阳市高水农副产品批发有限公司</div>
					</div>
				</div>
			</div>
		</form>

	</body>
	<script type="text/javascript" src="../../../JS/jquery.min.js"></script>
	<script type="text/javascript" src="../../../JS/checkCode.js"></script>
	<script type="text/javascript" src="../../../JS/common.js"></script>
	<script type="text/javascript" src="../../../JS/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../../../JS/json2.js"></script>
	<script type="text/javascript" src='../../../JS/SHA-1.js'></script>
	<script type="text/javascript">
		var code;

		document.onkeydown = jumpPage; //有键盘的键被按下，触发事件

		function jumpPage(event) {
			var ev = event || window.event;
			if(ev.keyCode == 13){
				//按下回车
				login();
			}
		}

		function login() {
			var checkresult = checkLoginInfo();
			if(checkresult) {
				var identifying_code = $("#identifying_code").val(); //获取输入 的验证码
				var user = $("#txtUserName").val();
				var pass = $("#txtPassword").val(); //获得用户名和密码的值
				$.post(RemoteLinkAddress + "/login.do", {
						"USER_NAME": user,
						"USER_PSW": hex_sha1(pass)
					},
					function(result) {
						if(result.currUser != null) {
							$.messager.alert('提示信息', '登录成功!');
							localStorage.setItem('check', JSON.stringify(result.check)); //周期检查到期提醒
							localStorage.setItem('contractBoost', JSON.stringify(result.contractBoost));
							localStorage.setItem('contractShort', JSON.stringify(result.contractShort));
							localStorage.setItem('frozen', JSON.stringify(result.frozen));
							localStorage.setItem('currUser', JSON.stringify(result.currUser)); //当前用户信
							localStorage.setItem('role', JSON.stringify(result.role)); //存储当前用户的权限信息
							location.href = "../../../index.html";
						} else {
							$.messager.alert('警告', '登录失败!');
							return;
						}
					},
					'json');
			}
		}
		function formReset() {
			document.getElementById("form1").reset()
		}

		function checkLoginInfo() {
			var txtUserName = $("#txtUserName").val();
			var txtPassword = $("#txtPassword").val();
			var _code = $("#checkCode").html();
			console.log(_code);
			var identifying_code = $("#identifying_code").val().toLowerCase(); //获取输入 的验证码、用户名和密码
			console.log(identifying_code + " " + _code);
			if(txtUserName === "" && txtPassword === "" && identifying_code === "") {
				$.messager.alert("提示", "请完善页面登录信息！");
				return false;
			}
			if(txtUserName === "") {
				$.messager.alert("提示", "用户名不能为空！");
				return false;
			}
			if(txtPassword === "") {
				$.messager.alert("提示", "密码不能为空！");
				return false;
			}
			if(identifying_code === "") {
				$.messager.alert("提示", "验证码不能为空！");
				return false;
			}
			if(identifying_code !== _code.toLowerCase()) {
				$.messager.alert("提示", "验证码不正确！");
				return false;
			}
			return true;
		}
	</script>

</html>